﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Kaidou.Model;
using Kaidou.Persister;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using Kaidou.Util;
using Kaidou.Bll;

public partial class master_master_branch_view : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        LoginModel loginModel = (LoginModel)Session["loginModel"];

        if (loginModel == null)
        {
            Response.Redirect("../login.aspx");
        }
        else if (!loginModel.isOperator() && !loginModel.isJimukyoku())
        {
            Response.Redirect("../menu.aspx");
        }

        if (!IsPostBack)
        {
            string area = Resources.Resource.area;
            string[] areaArray = area.Split(',');
           
            MST_Union_BranchPersister dao = new MST_Union_BranchPersister();
           
           
            mst_union_branch M = dao.getDetail(Request.QueryString["unioncode"].ToString(), int.Parse(Request.QueryString["branchcode"].ToString()));
            Session["mstunionbranch"] = M;
            MST_UnionPersister dao2 = new MST_UnionPersister();
            MstUnion parent = dao2.getDetail(M.Id.unioncode);
            union_code.Text = M.Id.unioncode + " " + parent.OfficeName; ;
            branch_code.Text =StringUtil.getBranchCodeNumberFormat(  M.Id.branchcode);
            office_address.Text = M.officeaddress;
            office_city.Text = M.officecity;
            office_email.Text = M.officeemail;
            office_fax.Text = M.officefax;
            office_kana.Text = M.officekana;
            office_name.Text = M.officename;
            office_pref_code.Text = areaArray[M.officeprefcode - 1];
            office_tel.Text = M.officetel;
            office_zip_no.Text = M.officezipno;
            tanto_kana.Text = M.tantokana;
            tanto_name.Text = M.tantoname;
            password.Text = M.password;

        }

    }

    protected void goback(object sender, EventArgs e)
    {
        Session["back"] = 1;
        Response.Redirect("master_branch_search.aspx");

    }
}
